#include<bits/stdc++.h>
using namespace std;

int fun(int m, int n)
{
	if(n > m)
		return fun(m, m);
	if(m == 0)
		return 1;
	if(n == 0)
		return 0;
	
	return fun(m, n-1) + fun(m-n, n);
}

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int m, n;
		cin>>m>>n;
		cout<<fun(m, n)<<endl;
	}
	cout<<endl;
	system("pause"); 
	return 0;
}

